<?php

namespace App\Console\Commands;


use Illuminate\Console\Command;
use App\Service\Dir;


class DelCache extends Command
{
    //  删除缓存（可以重复执行）
    // php artisan command:del-cache
    protected $signature   = 'command:del-cache';
    protected $description = '删除缓存数据（各种缓存的文件）';
    protected $channels    = ['news', 'dispatch', 'point', 'abroad'];

    public function __construct()
    {
        parent::__construct();
    }

    // 执行的命令
    public function handle()
    {

        $this->info($this->description);
        // storage_path('logs/laravel.log')
        //$path = Config::get('cache.stores.file.path');
        //  'framework/cache/data' 不要删除 这里含有app_key
        $channel = ['logs/', 'framework/bang.list', 'framework/bang.show', 'framework/field','framework/model','framework/logic','framework/response','framework/table', 'framework/views',];
        $dir = new Dir();

        foreach($channel as $path){
            $path = storage_path($path);
            $this->info('清空目录'.$path);
            $dir->delDir($path,false);
        }
    }
}

